package net.zjict.lib.structural.proxy.computer;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 动态代理
 */
public class DynamicCalculation<T> implements InvocationHandler {
    private T t;

    public DynamicCalculation(T t) {
        this.t = t;
    }

    @Override
    public Object invoke(Object o, Method method, Object[] objects) throws Throwable {

        System.out.println("readying");
        T result= (T) method.invoke(t,objects);
        System.out.println("ending");
        return result;
    }
}
